1 <?
2 if
(isset($_POST['butSaveLoai'])) {
3     $name=$_POST[
'txtName'];
4     $status=($_POST[
'chkShow']!=''?1:0);
5     $parent=$_POST[
'txtParent'];
6             
7     $name = trim($_POST[
'txtName']);
8     
if ($name=="")
9     {
10         echo
"<p align=center class='err'>B&#7841;n ch&#432;a nh&#7853;p tên danh m&#7909;c</p>";
11     }
12     
else
13     {
14         
if (!empty($_POST['oldid'])) {
15             $oldid = $_POST[
'oldid'];
16             $sql =
"update doc_categories set doc_categories_name='".$name."', doc_categories_status='".$status."', doc_categories_parentid='".$parent."' where doc_categories_id='".$oldid."'";
17         }
18         
else
19             $sql =
"insert into doc_categories (doc_categories_name,doc_categories_parentid,doc_categories_status,date_added) values ('".$name."',".$parent.",".$status.",SYSDATE())";
20         
if (mysql_query($sql,$con)) {
21             echo
"<p align=center class='err'>&#272;ã c&#7853;p nh&#7853;t thành công</p><br>";
22             echo
"<script>window.location='index.php?act=edoc_category&page=".$_REQUEST['page']."&code=1'</script>";
23         }
24         
else echo "<p align=center class='err'>Không th&#7875; c&#7853;p nh&#7853;t</p>";
25     }
26 }
27 ?>
28
29 <?
30     
if (isset($_GET['id'])) {
31         $oldid=$_GET[
'id'];
32         $sql =
"select * from doc_categories where doc_categories_id='".$oldid."'";
33         
if ($result = mysql_query($sql,$con)) {
34             $row=mysql_fetch_array($result);
35             $name=$row[
'doc_categories_name'];
36             $status=$row[
'doc_categories_status'];
37             $parent=$row[
'doc_categories_parentid'];
38         }
39     }
40 ?>
41
42 <form method=
"POST" action="index.php?">
43 <input type=hidden name=
"act" value="edoc_category_m">
44 <input type=hidden name=
"oldid" value="<? echo $oldid; ?>">
45 <input type=hidden name=
"page" value="<? echo $_REQUEST['page']; ?>">
46 <table border=
"1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
47   <tr>
48     <td width=
"45%" height="20" class="title" align="center">Thêm m&#7899;i / C&#7853;p nh&#7853;t
49     : Danh th&#
432; vi&#7879;n</td>
50   </tr>
51   <tr>
52     <td width=
"45%">
53     <table border=
"0" cellpadding="4" bordercolor="#111111" width="124%" id="AutoNumber2" cellspacing="0">
54       <tr>
55         <td width=
"15%" class="smallfont">
56         <p align=
"right">Tên danh m&#7909;c</td>
57         <td width=
"1%" class="smallfont">
58         <font color=
"#FF0000">*</font></td>
59         <td width=
"83%" class="smallfont">
60         <INPUT
value="<? echo $name; ?>" TYPE="text" NAME="txtName" CLASS=textbox size="34"></td>
61       </tr>
62      <tr>
63         <td width=
"15%" class="smallfont" align="right">
64         Không cho hi&#
7875;n th&#7883;</td>
65         <td width=
"1%" class="smallfont">
66         &nbsp;</td>
67         <td width=
"83%" class="smallfont">
68         <input type=
"checkbox" name="chkShow" value="ON" <? if ($status>0) echo 'checked' ?>></td>
69       </tr>
70      <tr>
71         <td width=
"15%" class="smallfont">
72         <p align=
"right">Thu&#7897;c danh m&#7909;c</td>
73         <td width=
"1%" class="smallfont">
74         &nbsp;</td>
75         <td width=
"83%" class="smallfont">
76         <
select size="1" name="txtParent">
77 <?
78         echo
"<option value='1'>[Danh m&#7909;c g&#7889;c]</option>";
79         
//$cats=GetListDoc(1);
80         
//foreach ($cats as $cat)
81         
//{
82         
// if ($cat[0]==$parent)
83         
// echo "<option value=".$cat[0]." selected>".$cat[1]."</option>";
84         
// else
85     
// echo "<option value=".$cat[0].">".$cat[1]."</option>";
86     
// }
87 ?>
88         </
select>
89         
90 </td>
91       </tr>
92       <tr>
93         <td width=
"15%" class="smallfont">
94         <p align=
"right">
95         <INPUT TYPE=
"submit" NAME="butSaveLoai" VALUE="C&#7853;p nh&#7853;t" CLASS=button>&nbsp;</td>
96         <td width=
"1%" class="smallfont">
97         &nbsp;</td>
98         <td width=
"83%" class="smallfont"><p align="left">&nbsp;<INPUT TYPE="reset" CLASS=button value="Nh&#7853;p l&#7841;i"></td>
99       </tr>
100       
101     </table>
102     </td>
103   </tr>
104   </table>
105 </form>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.970 lượt xem

Gõ tìm kiếm nhanh...